package effective_java.singleton;

public class SingleObject {

    // 创建自身对象
    public static SingleObject instance = new SingleObject();

    // 使构造器为私有，无法被调用
    private SingleObject(){}

    // 获取唯一可用对象
    public static SingleObject getInstance() {
        return instance;
    }

    public void showMessage() {
        System.out.println("SingleObject Message.");
    }

}
